﻿/* 
 * author: www.cnblogs.com/luminji
 * date  : 2011/12/28
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Luminji.Core.Xaml;

namespace Luminji.Exam.Model.Papers
{
    public static class PaperFormator
    {
        public static void PaperDetailsFormat(IList<PaperDetail> paperDetails, string contentFormat)
        {
            if (contentFormat == "XAML")
            {
                foreach (var item in paperDetails)
                {
                    item.QuestionStemContent = ExamXamlConverter.XamlToHtml(item.QuestionStemContent);
                    item.QuestionStemContent = Microsoft.JScript.GlobalObject.escape(item.QuestionStemContent);
                    item.QuestionFaceContent = ExamXamlConverter.XamlToHtml(item.QuestionFaceContent);
                    item.QuestionFaceContent = Microsoft.JScript.GlobalObject.escape(item.QuestionFaceContent);
                    foreach (QuestionOption option in item.QuestionOptions)
                    {
                        option.OptionsValue = ExamXamlConverter.XamlToHtml(option.OptionsValue);
                        option.OptionsValue = Microsoft.JScript.GlobalObject.escape(option.OptionsValue);
                    }
                }

            }
        }
    }
}
